-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Google Cloud Storage support (GCS) #2193
Conversation
Thanks for the pull request, @shadinaif! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
@shadinaif Thank you for this contribution! Let us know when the changes are ready for review. |
Hey @shadinaif, just checking in to see if you're still planning to continue working on this PR? |
Thank you for the reminder @itsjeyd . Yes, it's on production and working fine. I'll rebase and set to review soon |
5fc79b6
to
81c511c
Compare
@shadinaif Sounds good, thanks for the update. |
Hey @shadinaif, do you have any updates about when you'll be able to come back to this PR? |
Thanks for the follow-up @itsjeyd , I'll get back to it and complete it on Tuesday, June 4, 2024 I promise. I've added it to my schedule. Sorry for the delay 🙏🏼 |
Sounds good, thanks for the update @shadinaif. |
7a5ecbb
to
c520148
Compare
@shadinaif It looks like tests will need some further tweaking here. Could you have a look? |
089d5f4
to
e41bab5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2193 +/- ##
==========================================
+ Coverage 95.09% 95.12% +0.02%
==========================================
Files 195 196 +1
Lines 21479 21584 +105
Branches 1931 1935 +4
==========================================
+ Hits 20425 20531 +106
Misses 787 787
+ Partials 267 266 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hey @shadinaif, thanks for working on the tests. It looks like some of them are still failing. Will you be taking another look? |
Thanks for the reminder @itsjeyd , I'll do in a couple of days 👍🏼 |
@shadinaif Just checking in to see if you're still planning to continue working on this PR? If you don't think you'll get to it in the short term, it might make sense to close it for the time being. |
76a4a62
to
0461792
Compare
@@ -7,7 +7,7 @@ deps = | |||
django42: Django>=4.2,<5.0 | |||
|
|||
commands = | |||
pytest | |||
pytest {posargs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not related to the PR, it just makes it easier to run tests for a single file or object locally
0461792
to
1e9c989
Compare
[E0606(possibly-used-before-assignment), TeamMixin.add_team_submission_context] Possibly using variable team_submission before assignment [E0606(possibly-used-before-assignment), serialize_training_examples] Possibly using variable parts before assignment [E0606(possibly-used-before-assignment), StaffWorkflowListViewUnitTests.test_bulk_fetch_annotated_staff_workflows] Possibly using variable assessment_ids before assignment
eb297fd
to
8fd1c39
Compare
@itsjeyd thank you for your patience on this. I've added the needed tests, and I also had to fix some linter errors not related to the PR. All green now |
@shadinaif Great! I'm marking this PR as ready for review now. |
Hi @openedx/2u-aurora team, this PR is ready for engineering review. @feanil I can't formally request a review from the Aurora team, could you please update the team's permissions for this repo to make that possible? |
Added the team to the repo and tagged them for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shadinaif , I'm having trouble getting Google Cloud credentials configured to test this change. Are you planning to submit a GCS integration PR to the platform?
I found documentation for initializing the GS_CREDENTIALS
setting, but since it requires initializing that setting as a google.oauth2.service_account.Credentials
object, I can't configure it with yml, and would have to modify the platform's envs/*.py
files.
And without platform integration, I don't think we should add it to ORA2 either. Open to discussion though, let me know?
@@ -134,7 +134,7 @@ def add_team_submission_context( | |||
raise TypeError("One of team_submission_uuid or individual_submission_uuid must be provided") | |||
if team_submission_uuid: | |||
team_submission = get_team_submission(team_submission_uuid) | |||
elif individual_submission_uuid: | |||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks unrelated?
@@ -625,6 +625,7 @@ def serialize_training_examples(examples, assessment_el): | |||
answer_el = etree.SubElement(example_el, 'answer') | |||
try: | |||
answer = example_dict.get('answer') | |||
parts = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks unrelated?
@@ -2,7 +2,7 @@ | |||
# This file is autogenerated by pip-compile with Python 3.8 | |||
# by the following command: | |||
# | |||
# make upgrade | |||
# pip-compile --output-file=requirements/quality.txt requirements/quality.in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This repo is missing the compile-requirements
make target, but would you be willing to add it with the diff below? Then you can run make compile-requirements
and avoid this unneeded change to the requirements file.
diff --git a/Makefile b/Makefile
index 68cc2a636..aa2ca0bcf 100644
--- a/Makefile
+++ b/Makefile
@@ -43,23 +43,23 @@ $(COMMON_CONSTRAINTS_TXT):
wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)"
echo "$(COMMON_CONSTRAINTS_TEMP_COMMENT)" | cat - $(@) > temp && mv temp $(@)
-upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
-upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
+compile-requirements: export CUSTOM_COMPILE_COMMAND=make upgrade
+compile-requirements: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
# global common_constraints has this pin.
sed 's/django-simple-history==3.0.0//g' requirements/common_constraints.txt > requirements/common_constraints.tmp
mv requirements/common_constraints.tmp requirements/common_constraints.txt
pip install -qr requirements/pip-tools.txt
- pip-compile --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in
- pip-compile --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
+ pip-compile ${COMPILE_OPTS} --allow-unsafe -o requirements/pip.txt requirements/pip.in
+ pip-compile ${COMPILE_OPTS} -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
- pip-compile --upgrade -o requirements/base.txt requirements/base.in
- pip-compile --upgrade -o requirements/test.txt requirements/test.in
- pip-compile --upgrade -o requirements/quality.txt requirements/quality.in
- pip-compile --upgrade -o requirements/test-acceptance.txt requirements/test-acceptance.in
- pip-compile --upgrade -o requirements/tox.txt requirements/tox.in
- pip-compile --upgrade -o requirements/ci.txt requirements/ci.in
- pip-compile --upgrade -o requirements/docs.txt requirements/docs.in
+ pip-compile ${COMPILE_OPTS} -o requirements/base.txt requirements/base.in
+ pip-compile ${COMPILE_OPTS} -o requirements/test.txt requirements/test.in
+ pip-compile ${COMPILE_OPTS} -o requirements/quality.txt requirements/quality.in
+ pip-compile ${COMPILE_OPTS} -o requirements/test-acceptance.txt requirements/test-acceptance.in
+ pip-compile ${COMPILE_OPTS} -o requirements/tox.txt requirements/tox.in
+ pip-compile ${COMPILE_OPTS} -o requirements/ci.txt requirements/ci.in
+ pip-compile ${COMPILE_OPTS} -o requirements/docs.txt requirements/docs.in
# Delete django pin from test requirements to avoid tox version collision
sed -i.tmp '/^[d|D]jango==/d' requirements/test.txt
sed -i.tmp '/^djangorestframework==/d' requirements/test.txt
@@ -70,6 +70,9 @@ upgrade: $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with
# Delete temporary files
rm requirements/*.txt.tmp
+upgrade: ## update the pip requirements files to use the latest releases satisfying our constraints
+ $(MAKE) compile-requirements COMPILE_OPTS="--upgrade"
+
Thanks for picking up the review for this PR @pomegranited! |
Hey @shadinaif, just checking in to see if you're still planning to continue working on this PR? |
Hi @itsjeyd , looks like I missed the notification for the review. I'll continue with it on the weekend. Thank you for the ping! |
Hi @shadinaif, it's been about a month without any activity here, so I'm closing this PR for now. Feel free to reopen it (or open a new one) when you're ready to come back to this work. |
TL;DR - This is to add support to GCS files backend by adding a new option (
gcs
) toORA2_FILEUPLOAD_BACKEND
JIRA: ---
What changed?
ORA2_FILEUPLOAD_BACKEND
environment variable accepts a new valuegcs
in addition to the existing options (s3
,filesystem
,swift
, anddjango
)django-storages[google]
instead of the defaultdjango-storages
which will includegoogle-cloud-storages
Important to know!
Using GSC with ORA means that
edx-platform
is already configured to use GCS instead of S3django-storages[google]
instead of the defaultdjango-storages
which will includegoogle-cloud-storages
DEFAULT_FILE_STORAGE
is set tostorages.backends.gcloud.GoogleCloudStorage
in edx-platform. Other configurations might be needed tooedx-platform
functions directly and seamlessly with GCS without a proxy like MinIO or boto3Developer Checklist
Testing Instructions
Using tutor development:
edx-platform
to use GCS, including the installation of django-storages[google]ORA2_FILEUPLOAD_BACKEND
togcs
FILE_UPLOAD_STORAGE_BUCKET_NAME
Reviewer Checklist
Collectively, these should be completed by reviewers of this PR:
FYI: @openedx/content-aurora